package com.guet.game.weapon;

import com.guet.game.airplanes.dao.FlyingObj;
import com.guet.game.utils.Images;

import java.awt.image.BufferedImage;

public class Bullet extends FlyingObj {
	public int speed;
	Type type;

	public enum Type {
		line,
		obliqueL,
		obliqueR,
	}

	public Bullet(int x, int y, Type type) {
		super(8, 20,x,y);
		speed = 4;
		this.type = type;
	}


	public Bullet(int x, int y, int speed, Type type) {
		super(8, 20,x,y);
		this.speed = speed;
		this.type = type;
	}

	@Override
	public BufferedImage getImage() {
		//System.out.println(Images.bullet);
		if(state == LIFT) {
			switch (type){
				case line:
					return Images.bullet[0];
				case obliqueR:
					return Images.bullet[1];
				case obliqueL:
					return Images.bullet[2];
			}
		}
		else if(state == DEAD) {
			//state=REMOVE;
			return null;
		}
				
			return null;
	}

	@Override
	public void move() {
		switch (type){
			case line:
				y -= speed;
				break;
			case obliqueL:
				y -= speed;
				x -= speed / 2;
				break;
			case obliqueR:
				y -= speed;
				x += speed / 2 ;
				break;
		}
	}

}
